package nl.nickthissen.remindme.data;

import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;

import java.io.Serializable;
import java.util.List;

/**
 * Created by nthissen on 11/06/13.
 */
@Table(name="Categories")
public class Category extends Model implements Serializable
{
    @Column(name="Name")
    public String name;

    @Column(name="Description")
    public String description;

    @Column(name="Color")
    public int color;

    @Column(name="IsDefault")
    public int isDefault;

    public List<ReminderItem> items()
    {
        return getMany(ReminderItem.class, "Category");
    }

    @Override
    public boolean equals(Object obj)
    {
        if (obj == null) return false;
        if (obj == this) return true;
        if (!(obj instanceof Category)) return false;

        Category other = (Category)obj;
        return other.getId().equals(getId());
    }
}
